
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="mall/header::head-fragment('NewBee商城-选择支付方式','pay-select')">
</head>
<body>
<div class="page-main">
    <div class="container confirm-box">
        <form target="_blank" action="#" id="J_payForm" method="post">
            <div class="section section-order">
                <div class="order-info clearfix">
                    <div class="fl">
                        <h2 class="title">订单提交成功！去付款咯～</h2>
                        <input type="hidden" id="orderNoValue" th:value="${order.orderNo}">
                        <p class="order-time" id="J_deliverDesc">订单号：
                            <th:block th:text="${order.orderNo}"></th:block>
                        </p>
                    </div>
                    <div class="fr">
                        <p class="total">
                            应付总额：<span class="money"><em><th:block
                                th:text="${priceTotal}+'0'"></th:block></em>元</span>
                        </p>
                    </div>
                </div>
            </div>
            <div class="section section-payment">
                <div class="cash-title" id="J_cashTitle">
                    选择以下支付方式付款
                </div>

                <div class="payment-box ">
                    <div class="payment-header clearfix">
                        <h3 class="title">支付平台</h3>
                        <span class="desc"></span>
                    </div>
                    <div class="payment-body">
                        <ul class="clearfix payment-list J_paymentList J_linksign-customize">
                            <li class="J_alipay">
                                <input type="radio" name="payOnlineBank" id="alipay" value="alipay">
                                <img onclick="payOrder(1)" th:src="@{/mall/image/pay/payOnline_zfb.png}" alt="支付宝"
                                     style="margin-left: 0;"></li>
                            <li id="J_weixin">
                                <input type="radio" name="payOnlineBank" id="wxpay" value="alipay">
                                <img onclick="payOrder(0)" th:src="@{/mall/image/pay/weixinpay.png}" alt="微信支付"
                                     style="margin-left: 0;">
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div th:replace="mall/footer::footer-fragment"></div>

<!-- jQuery -->
<script th:src="@{/admin/plugins/jquery/jquery.min.js}"></script>
<!-- Bootstrap 3 -->
<script th:src="@{/mall/js/bootstrap3.js}"></script>
<script th:src="@{/mall/js/search.js}" type="text/javascript"></script>
<script th:src="@{/admin/plugins/sweetalert2/sweetalert2.all.min.js}"></script>
<script th:src="@{/mall/js/pay-select.js}" type="text/javascript"></script>
<script th:src="@{/mall/js/bootstrap3.js}"></script>
<script>
    $(document).ready(function() {
        // 监听所有商品链接点击事件，假设所有商品链接都在 #flash, #recommend 这类容器内
        // 你可以根据实际结构调整选择器
        $("#flash, #recommend, #sub_banner").on("click", "a", function(event) {
            var $link = $(this);
            var href = $link.attr("href");
            var id = $link.data("id");
            var name = $link.data("name");

            // 如果没有data-id，尝试从href中提取数字ID，假设URL是item/detail/123这种格式
            if (!id && href) {
                var match = href.match(/(\d+)/);
                if (match) {
                    id = match[1];
                }
            }

            if (!name) {
                // 如果没有data-name，可以用链接文本或空字符串
                name = $link.find(".name").text() || $link.text() || "";
            }

            var eventData = {
                productId: id || "unknown",
                productName: name || "unknown",
                timestamp: new Date().toISOString()
            };

            // 发送 Ajax 请求
            $.ajax({
                url: '/api/track/click',
                method: 'POST',
                contentType: 'application/json',
                data: JSON.stringify(eventData),
                success: function() {
                    console.log("点击事件已发送：", eventData);
                },
                error: function(err) {
                    console.error("点击事件发送失败：", err);
                }
            });
        });
    });
</script>
</body>
</html>